package com.lx.util;

import com.lx.bean.User;

import javax.servlet.http.HttpSession;

/**
 * @ClassName: UserUtil
 * @Description:
 * @Date Created in  2021-07-08 22:06
 * @Modified By:
 * @Author: 零巽
 */
public class UserUtil {
    public static String getSysPhone(HttpSession session) {
        String sysPhone = (String) session.getAttribute("sysPhone");
        return sysPhone;
    }

    public static String getAdminUserName(HttpSession session) {
        Object adminUserName = session.getAttribute("adminUserName");
        return (String) adminUserName;
    }

    public static String getUserName(HttpSession session) {
        Object UserName = session.getAttribute("UserName");
        return (String) UserName;
    }

    public static String getLoginSMS(HttpSession session,String userPhone) {
        return (String) session.getAttribute(userPhone);
    }

    public static void setLoginSMS(HttpSession session, String userPhone, String code) {
        session.setAttribute(userPhone, code);
    }

    public static void setUser(HttpSession session, User user) {
        session.setAttribute("user",user);
    }

    public static User getUser(HttpSession session) {
        return (User) session.getAttribute("user");
    }
}
